/**
* Copyright 2020 Huawei Technologies Co., Ltd
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at

* http://www.apache.org/licenses/LICENSE-2.0

* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.

* File utils.h
* Description: handle file operations
*/
#pragma once

#include <iostream>
#include <vector>
#include <memory>
#include <mutex>
#include <condition_variable>
#include <unistd.h>
#include <vector>
#include <sys/socket.h>
#include <netinet/in.h>
#include <arpa/inet.h>
#include <queue>
#include <thread>

#include <opencv2/opencv.hpp>
#include "opencv2/imgcodecs/legacy/constants_c.h"
#include "opencv2/imgproc/types_c.h"
#include "atlas_type.h"


#include "acl/acl.h"

#define LOCAL_IP "192.168.222.8"
#define ATP_PORT 12008

using namespace std;

template<class Type>
std::shared_ptr<Type> MakeSharedNoThrow() {
    try {
        return std::make_shared<Type>();
    }
    catch (...) {
        return nullptr;
    }
}

#define MAKE_SHARED_NO_THROW(memory, memory_type) \
    do { \
            memory = MakeSharedNoThrow<memory_type>(); \
    }while(0);


// 存储图像数据的联合体
using Data1 = union
{
    uint8_t uint8[65536];
    uint16_t uint16[32768];
    uint32_t uint32[16384];
    int16_t int16[32768];
    int32_t int32[16384];
};


typedef struct
{
    unsigned int head;
    unsigned int len;
    unsigned int id;
    unsigned short seq;
    unsigned short num;
    Data1 frm_body;
    unsigned int tail;
    unsigned char check;
}Frame1;

#define HEAD_FLAG1 0x52445324
/**
 * Utils
 */
class UtilsRetina {
public:

};
